<?php
pc_base::load_app_class('hchbase','hchindex',0);
class index extends hchbase {
	
	function __construct() {
		parent::__construct();
		$this->bulletInfo0 = '华创俱乐部';
		$this->bulletInfo1 = '首页';
	}
	
	function init(){
		
		$whereSql = " is_show = 1";
		$orderSql = " show_index ASC,id DESC";
		$nav = $this->dbType->select($whereSql,'*','',$orderSql);

		$whereSql = " parent = 1";
        $assortTypeList = $this->dbType->select($whereSql);

        $news = '';
        $projects = '';
        $hr = '';
        $roadshow = '';
        $clubList = '';
        $storyList = '';
        $serviceList = '';

        foreach($assortTypeList as $type){
            $typeId = $type['id'];
            $whereSql = array('assort_type_id'=>$typeId,'is_del'=>0);
            $orderSql = " id DESC";
            switch($type['name']){
                case 'news':
                	$newsTpyeId = $typeId;
                    $news = $this->db->get_one($whereSql,'*',$orderSql);
                    break;
                case 'project':
                	$projectTpyeId = $typeId;
                    $projects = $this->db->get_one($whereSql,'*',$orderSql);
                    $projects['short_content'] = mb_substr($projects['short_content'],0,97, 'utf-8');
                    break;
                case 'hr':
                	$hrTpyeId = $typeId;
                    $hr = $this->db->get_one($whereSql,'*',$orderSql);
                    $hr['short_content'] = mb_substr($projects['short_content'],0,97, 'utf-8');
                    break;
                case 'roadshow':
                	$roadshowTpyeId = $typeId;
                    $roadshow = $this->db->get_one($whereSql,'*',$orderSql);
                    $roadshow['short_content'] = mb_substr($roadshow['short_content'],0,97, 'utf-8');
                    break;
                case 'club':
                	$clubTpyeId = $typeId;
                    $clubList = $this->db->select($whereSql,'*','0,3',$orderSql);
                    for($i=0;$i<count($clubList);$i++){
                    	$clubList[$i]['short_content'] = mb_substr($clubList[$i]['short_content'],0,97, 'utf-8');
                    }
                    break;
                case 'story':
                	$storyTpyeId = $typeId;
                    $storyList = $this->db->select($whereSql,'*','0,3',$orderSql);
                    for($i=0;$i<count($storyList);$i++){
                    	$storyList[$i]['short_content'] = mb_substr($storyList[$i]['short_content'],0,97, 'utf-8');
                    }
                    break;
                case 'servicelist':
                	$serviceTpyeId = $typeId;
                    $serviceList = $this->db->select($whereSql,'*','0,3',$orderSql);
                    for($i=0;$i<count($serviceList);$i++){
                    	$serviceList[$i]['short_content'] = mb_substr($serviceList[$i]['short_content'],0,97, 'utf-8');
                    }
                    break;
                default:break;
            }
        }

		include template ( 'content', 'index' );
	}
    function news_datail(){
        if(isset($_GET['news_id']) && $_GET['news_id']){
            $news_id = $_GET['news_id'];
        }else{
            $news_id = 0;
        }
        $whereSql['id'] = $news_id;
        $news = $this->db->get_one($whereSql,'*');

        include template ( 'content', 'news_detail' );
    }
}
?>